<?php
    /*
     * HLstats - Real-time player and clan rankings and statistics for Half-Life
     * http://sourceforge.net/projects/hlstats/
     *
     * Copyright (C) 2001  Simon Garner
     *               2005  Teemu A <teemu@terrasolid.fi>
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * as published by the Free Software Foundation; either version 2
     * of the License, or (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     */



    /*
     * HLstats Page Header
     * This file will be inserted at the top of every page generated by HLstats.
     * This file can contain PHP code.
     */


    if(!defined("_HLSTATS")) die("Direct access denied.");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
        <base href="http://<?php
$jag = $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']);
if(substr($jag,-1) != "/") $jag .= "/";
echo $jag; ?>" />
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
    <title>Rautakuu [dot] org :: HLstλts<?php
        foreach ($title as $t)
        {
            echo " » $t";
        }
    ?></title>
    <?php $faviconimg = getImage("/player"); ?>
    <link rel="icon" href="<?=$faviconimg['url'];?>" type="image/gif" >
    <style type="text/css">
    <!--
        .fontNormal
        {
            font-family: Verdana, Arial, sans-serif;
            font-size: 11px;
        }

        .fontSmall
        {
            font-family: Verdana, Arial, sans-serif;
            font-size: 9px;
        }

        .fontTitle
        {
            font-family: Arial, sans-serif;
            font-size: 18px;
        }

        .weapon
        {
            text-decoration: none;
        }

        INPUT,
        TEXTAREA,
        SELECT
        {
            font-family: Verdana, Arial, sans-serif;
            font-size: 11px;
            background-color:#161652;
            color:#EEEEEE;
            <?php $bodybgimg = getImage("/csbg"); ?>
            background-image: url('<?=$bodybgimg['url'];?>');
            background-position: bottom right;
            background-repeat: no-repeat;
            background-attachment: fixed;
        }

        INPUT.textbox,
        INPUT.checkbox
        {
            border-width: 1px;
        }

        INPUT.submit
        {
            height: 22px;
        }

        INPUT.smallsubmit
        {
            font-size: 9px;
            height: 20px;
        }

        TT
        {
            font-family: Courier New, Courier, fixed;
            font-size: 12px;
        }

        BODY
        {
            <?php $bodybgimg = getImage("/csbg"); ?>
            background: url('<?=$bodybgimg['url'];?>') bottom right no-repeat;
            background-attachment: fixed;
            background-color:<?=$g_options["body_bgcolor"];?>;
            margin-top: <?php echo $g_options["body_topmargin"]; ?>px;
            margin-right: <?php echo $g_options["body_leftmargin"]; ?>px;
            margin-bottom: <?php echo $g_options["body_topmargin"]; ?>px;
            margin-left: <?php echo $g_options["body_leftmargin"]; ?>px;
            padding:0px;
            font-family: Verdana, Arial, sans-serif;
            font-size: 11px;
        }

        a {
            text-decoration:none;
        }
        a:hover
        {
            color:<?php echo $g_options["body_hlink"]; ?>;
            text-decoration:underline;
        }
        img {
            vertical-align:middle;
        }

        /* Tabs */
        ul.tabs {
            text-align: center;
            padding:0px;
            margin:0px;
            white-space: nowrap;
            border: solid <?=$g_options["table_border"]; ?>;
            border-width: 1px 0;
            border-collapse: collapse;
        }
        ul.tabs li {
            padding:0px;
            margin:0px;
            color: <?= $g_options["table_head_text"]; ?>;
            display: inline;
        }
        ul.tabs li a {
            border: none;
            height: auto;
            padding: 0em 1em;
            text-decoration: none;
            background: none;
            background-color:<?=$g_options["table_bgcolor1"];?>;
        }
        ul.tabs li a:hover {
            background-color:<?=$g_options["table_bgcolor2"];?>;
        }

        #overlay {
            width:100%;
            height:100%;
            z-index: 100;
            top:0;
            left:0;
            bottom:0;
            position:fixed;
            display:none;
            <?php $overlayimg = getImage("/overlay"); ?>
            background-image: url('<?=$overlayimg['url'];?>');
            text-align:center;
        }

        /* IE */
        * html #overlay{
            background-color: #333;
            background-color: transparent;
            <?php $spacerimg = getImage("/spacer"); ?>
            background-image: url('<?=$spacerimg['url'];?>');
            filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="<?=$overlayimg['url'];?>", sizingMethod="scale");
        }

        #overlay img {
            padding:20px;
        }

        .table {
            background-color:<?= $g_options["table_border"]; ?>;
        }

        .tableRow1 {
            background-color:<?= $g_options["table_bgcolor1"]; ?>;
            background-position: bottom right;
            background-repeat: no-repeat;
            background-attachment: fixed;
        }

        .tableRow2 {
            background-color:<?= $g_options["table_bgcolor2"]; ?>;
            background-position: bottom right;
            background-repeat: no-repeat;
            background-attachment: fixed;
        }
    -->
    </style>

<?php
global $db;
$db->query("
           SELECT
               `to`, COUNT(`to`) AS cto
           FROM
               `hlstats_Link_Trace`
           WHERE
                `to` != '".$_SERVER['SCRIPT_URI']."'
           AND
                (
                    `whom` = '".$_SERVER['REMOTE_ADDR']."'
                AND
                    `from` = '".$_SERVER['SCRIPT_URI']."'
                )
           OR
                `from` = '".$_SERVER['SCRIPT_URI']."'
           OR
                `whom` = '".$_SERVER['REMOTE_ADDR']."'
           GROUP BY `to`
           ORDER BY `cto` DESC
           LIMIT 0, 3
           ");
while(list($to, $cto) = $db->fetch_row()) {
  echo "\n\t<meta http-equiv=\"Link\" content=\"&lt;".$to."&gt;; rel=prefetch\" />";
 }
?>
<script type="text/javascript">
<!--
// Due Hlstats requires _some_ optimizations, we use a
// small trick to disort them while page is loading

// First, preload bg image
loadingimg = new Image();
loadingimg.src = '<?=$loadingimg['url'];?>';

var oldTitle = document.title;

function nextpageLoading(msg) {
    document.getElementById("overlay").style.display='block';
    document.getElementById("overlay").setAttribute('title', msg);
    document.title = msg;
    setTimeout('hideMessageBox()', 8000);
}

function hideMessageBox() {
    if(document.getElementById("overlay")) {
        document.getElementById("overlay").style.display='none';
        document.title = oldTitle;
    }
}

function jump(url) {
    window.location=url;
    setTimeout('nextpageLoading("<?= _("Generating page...");?>")', 500);
}

// -->
</script>
<script type="text/javascript" src="cs-suggest/ggsgst.js"></script>
<script type="text/javascript" src="http://rautakuu.org/drupal/modules/bsod/bsod.js"></script>
</head>
<body bgcolor="<?php echo $g_options["body_bgcolor"]; ?>"
    background="<?php echo $g_options["body_background"]; ?>"
    text="<?php echo $g_options["body_text"]; ?>"
    link="<?php echo $g_options["body_link"]; ?>"
    vlink="<?php echo $g_options["body_vlink"]; ?>"
    alink="<?php echo $g_options["body_alink"]; ?>"
    onLoad="hideMessageBox();">
<?php $loadingimg = getImage("/loading"); ?>
<div id="overlay" onClick="hideMessageBox();"><img src="<?= $loadingimg['url']; ?>" align="center"></div>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr><td width="100%">
<table width="99%" align="center" border="0" cellspacing="0" cellpadding="0">

<tr valign="top">
    <td width="100%">
        <table width="100%" border=0 cellspacing=0 cellpadding=0>

        <tr valign="bottom">
            <td width="77" style="background-image:url(<?php echo $g_options["imgdir"]; ?>/title-background.gif);"><a href="<?php echo $g_options["scripturl"]; ?>"><img src="<?php echo $g_options["imgdir"]; ?>/title.gif" width="177" height="40" alt="HLstats" border="0"></a></td>
            <td align="right" style="background-image:url(<?php echo $g_options["imgdir"]; ?>/title-background.gif);"><a href="<?php echo $g_options["scripturl"]; ?>"><img src="<?php echo $g_options["imgdir"]; ?>/title-contents.gif" alt="Contents" border=0 hspace=2></a><a href="http://rautakuu.org/drupal/search/hlstats"><img src="<?php echo $g_options["imgdir"]; ?>/title-search.gif" alt="Search" border=0 hspace=2></a><a href="http://rautakuu.org/drupal/taxonomy/term/24"><img src="<?php echo $g_options["imgdir"]; ?>/title-help.gif" alt="Help" border=0 hspace=2></a><img src="<?php echo $g_options["imgdir"]; ?>/spacer.gif" width=6 height=1 border=0 alt="spacer.gif"></td>
        </tr>

        </table> </td>
</tr>
<tr valign="top">
    <td width="100%"><img src="<?php echo $g_options["imgdir"]; ?>/spacer.gif" width="1" height="1" border="0" alt="spacer.gif"></td>
</tr>
<tr valign="top">
    <td width="100%">

        <table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="<?php echo $g_options["location_bgcolor"]; ?>">

        <tr valign="middle">
            <td width="100%"><?php echo $g_options["font_normal"]; ?><font color="<?php echo $g_options["location_text"]; ?>">&nbsp;&nbsp;&nbsp;<?php if ($g_options["sitename"] && $g_options["siteurl"])
    {
        echo "<a href=\"" . $g_options["siteurl"] . "\" style=\"color: " . $g_options["location_link"] . "\">" . $g_options["sitename"] . "</a> » ";
    }

    echo "<a href=\"" . $g_options["scripturl"] . "\" style=\"color: " . $g_options["location_link"] . "\">HLstλts</a>";

    $i=0;
    foreach ($location as $l=>$url)
    {
        $url = ereg_replace("%s", $g_options["scripturl"], $url);
        echo " » ";

        if ($url)
        {
            echo "<a href=\"$url\" style=\"color: " . $g_options["location_link"] . "\">$l</a>";
        }
        else
        {
            echo "<b>$l</b>";
        }

        $i++;
    }

    echo "</font>";
    echo $g_options["fontend_normal"];
?></td>
        </tr>

        </table></td>
</tr>

</table>
<div style="width: 400px; margin: 0px auto; min-height: 22px; padding: 10px 10px 6px 42px; background-color:<?=$g_options["table_bgcolor1"];?>; border: 1px solid <?=$g_options["table_border"]; ?>; background: url('hlstatsimg/exit.png') 6px 3px no-repeat;" onClick="JavaScript:jump('http://rautakuu.org/drupal/node/98')"><strong><blink><span style="color:ff0000;">HUOM! OBS!</span></blink></strong> <a href="http://rautakuu.org/drupal/node/98">CS systemoinnit loppuvat/ovat loppuneet!</a></div>
<br>
<table width="90%" align="center" border=0 cellspacing=0 cellpadding=0>

<tr valign="top">
    <td width="100%"><?php
        echo $g_options["font_title"];

        end($title);
        echo current($title);

        echo $g_options["fontend_title"];
    ?></td>
</tr>
</table><p>
<p align="center">
<script type="text/javascript"><!--
google_ad_client = "<?=$g_options['google_ad_client'];?>";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "<?=substr($g_options["table_border"],1); ?>";
google_color_bg = "<?=substr($g_options["table_bgcolor1"],1); ?>";
google_color_link = "<?=substr($g_options["body_link"],1); ?>";
google_color_url = "<?=substr($g_options["body_link"],1); ?>";
google_color_text = "<?=substr($g_options["body_text"],1); ?>";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>

